package common.Forum;

import android.graphics.PixelFormat;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.Window;

import com.project.institute.DAO.InstituteFragmentActivityDAO;
import com.project.trac.R;

public class ActivityManager extends InstituteFragmentActivityDAO  {

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.commons_forum_manager);
		setTitle("Message Board >> " + getIntent().getExtras().getString("TITLE"));
		
		AdapterForum adapter = new AdapterForum(getApplicationContext(), getSupportFragmentManager());
		ViewPager vp = (ViewPager) findViewById(R.id.viewpager_forum_manager);

		vp.setAdapter(adapter);
		vp.setCurrentItem(0);

		vp.setOnPageChangeListener(new OnPageChangeListener() {

			/* call on the generic_indicators */
			public void onPageSelected(int position) {
				switch (position) {

				case 0:
					findViewById(R.id.generic_tab_first).setVisibility(View.VISIBLE);
					findViewById(R.id.generic_tab_second).setVisibility(View.INVISIBLE);
					break;

				case 1:
					findViewById(R.id.generic_tab_first).setVisibility(View.INVISIBLE);
					findViewById(R.id.generic_tab_second).setVisibility(View.VISIBLE);
					break;
				}
			}
			/* unused methods */
			public void onPageScrollStateChanged(int position) { }
			public void onPageScrolled(int arg0, float arg1, int arg2) { }
		});

	}

	@Override
	public void onAttachedToWindow() {
		super.onAttachedToWindow();
		Window window = getWindow();
		window.setFormat(PixelFormat.RGBA_8888);
	}
	
	@Override
	public void onBackPressed() {
		super.onBackPressed();
	}

}